package one;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class User {
    private int id;
    private String name;
    private List<Book> purchaseHistory;
    private Map<Book, Integer> ratings;

    public User(int id,String name) {
        this.id = id;
        this.name = name;
        this.purchaseHistory = new ArrayList<>();
        this.ratings = new HashMap<>();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public List<Book> getPurchaseHistory() {
        return purchaseHistory;
    }

    public void setPurchaseHistory(List<Book> purchaseHistory) {
        this.purchaseHistory = purchaseHistory;
    }

    public Map<Book, Integer> getRatings() {
        return ratings;
    }

    public void setRatings(Map<Book, Integer> ratings) {
        this.ratings = ratings;
    }

    public void purchase(Book book) {
        purchaseHistory.add(book);
    }

    public void rate(Book book, int rating) {
        ratings.put(book, rating);
    }
}

